package com.linkwechat.fegin;


import com.linkwechat.common.utils.ResultUtil;
import com.linkwechat.common.vo.CommonRsp;
import com.linkwechat.common.vo.qw.GetVisitUserVO;
import com.linkwechat.domain.wecom.vo.ConfigSignatureVO;
import com.linkwechat.domain.wecom.vo.department.QwDeptListVO;
import com.linkwechat.domain.wecom.vo.user.QwDeptUserVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * wjp
 * @see com.linkwechat.common.constant.WeServerNameConstants;
 */
@FeignClient(name = "linkwe-wx-api", path = "/wx-api")
public interface WxApiFeignClient {

    /**
     * 获取自建应用accessToken
     *
     * @return
     */
    @GetMapping("/qywx/sys/accessToken")
    CommonRsp<String> accessToken(
            @RequestParam(value = "corpId", required = true) String corpId,
            @RequestParam(value = "corpSecret", required = true) String corpSecret
    );

    /**
     * 通讯录accessToken 自建应用的通讯录accesstoken
     * @param corpId
     * @param contactSecret
     * @return
     */
    @RequestMapping(value = "/qywx/sys/contactAccessToken", method = RequestMethod.GET)
    public CommonRsp<String> contactAccessToken(
            @RequestParam(value = "corpId", required = true) String corpId,
            @RequestParam(value = "contactSecret", required = true) String contactSecret
    ) ;

    /**
     * 获取用户访问身份
     * @return
     */
    @RequestMapping(value = "/qywx/sys/loginAuthVisitUser", method = RequestMethod.GET)
    CommonRsp<GetVisitUserVO> loginAuthVisitUser(
            @RequestParam(value = "code", required = true) String code,
            @RequestParam(value = "accessToken", required = true) String accessToken
    );

    /**
     * 获取子部门ID列表
     * @return
     */
    @RequestMapping(value = "/qywx/sys/deptList", method = RequestMethod.GET)
    CommonRsp<QwDeptListVO> deptList(
            @RequestParam(value = "accessToken", required = true) String accessToken,
            @RequestParam(value = "id", required = false) String id
    );

    @RequestMapping(value = "/qywx/sys/deptUser", method = RequestMethod.GET)
    CommonRsp<QwDeptUserVO> deptUser(
            @RequestParam(value = "contactAccessToken", required = true) String contactAccessToken,
            @RequestParam(value = "nextCursor", required = false) String nextCursor
    );


    /**https://developer.work.weixin.qq.com/document/24364  往下翻
     * 获取 获取企业 jsapi_ticket
     * @return
     */
    @RequestMapping(value = "/qywx/sys/getJsapiTicket", method = RequestMethod.GET)
    public CommonRsp<String> getJsapiTicket(
            @RequestParam(value = "accessToken", required = true) String accessToken
    );

    /**
     * https://developer.work.weixin.qq.com/document/24364
     * jsjsdk用  企业的
     */
    @RequestMapping(value = "/qywx/sys/getConfigSignature", method = RequestMethod.GET)
    @ResponseBody
    public CommonRsp<ConfigSignatureVO> getConfigSignature(
            @RequestParam(value = "jsapiTicket", required = true) String jsapiTicket,
            @RequestParam(value = "url", required = true) String url
    );


    /**
     * 应用的 jsapi_ticket
     * @return
     */
    @RequestMapping(value = "/qywx/sys/getAgentJsapiTicket", method = RequestMethod.GET)
    public CommonRsp<String> getAgentJsapiTicket(
            @RequestParam(value = "accessToken", required = true) String accessToken,
            @RequestParam(value = "corpId", required = true) String corpId
            );

    /**
     *
     * jsjsdk的签名 应用的
     */
    @RequestMapping(value = "/qywx/sys/getAgentConfigSignature", method = RequestMethod.GET)
    @ResponseBody
    public CommonRsp<ConfigSignatureVO> getAgentConfigSignature(
            @RequestParam(value = "jsapiTicket", required = true) String jsapiTicket,
            @RequestParam(value = "url", required = true) String url
    ) ;



}
